<?php
namespace app\index\controller;

use app\index\model\Contentmodel;
use think\App;
use think\facade\View;

class Search extends Common
{
    protected $contentmodel;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->contentmodel = new Contentmodel();
    }

    public function index(){
        parent::index();
        $this->showData['keyWords'] = $this->request->request('keywords', '', 'string');
        $articleList = $this->contentmodel->findAll([['a.status', '=', 1], ['a.title', 'like', '%'.$this->showData['keyWords'].'%']], $this->request->param(), 8);
        $this->showData['articleList'] = $articleList['data'];
        $this->showData['page'] = $articleList['page'];
        $this->showData['redis'] = $this->handler;
        View::assign($this->showData);
        return view();
	}
}
